<template>
	<view>
		<dsl-navbar title="动态通知" bgTopImg="white" isBack></dsl-navbar>
		<view v-if="messageList && messageList.length!=0">
			<view v-for="(item,index) in messageList" :key="index" @click="messageDetail(item)">
				<view class="text-center margin-tb text-gray">
					{{item.createTime}}
				</view>
				<view class="bg-gray padding margin radius-sm">
					<view class=" rowsb align-center">
						<view>{{item.title}}</view>
						<view class="round bg-red" style="height: 20rpx;width: 20rpx;" v-if="item.readFlag ==0"></view>
					</view>
					<view class="margin-top text-gray">
						{{item.content}}
					</view>
				</view>
			</view>
		</view>
		<view v-else>
			<moreLoading></moreLoading>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'vuex'
	export default {
		data() {
			return {
				pageData: 1, //第一页
			}
		},
		//生命周期函数
		onReady() {},
		onLoad() {
			
		},
		onShow() {
			this.getmessageListApi({
				pageNum: 1,
			})
		},
		methods: {
			/**
			 *  getmessageListApi 消息列表接口
			 */
			...mapActions('message', ['getmessageListApi']),
			//触底刷新
			onReachBottom(e) {
				this.pageData++
				this.getmessageListApi({
					pageNum: this.pageData
				})
			},
			//详情跳转
			messageDetail(e){
				uni.navigateTo({
					url:"detail?id="+e.id
				})
			},
		},
		computed: {
			/**
			 * messageList 消息列表
			 */
			...mapState('message',
				[
					'messageList'
				])
		},
		components: {},
	}
</script>

<style lang="scss" scoped>
	.bg-gray {
		background: #F7F6FA;
	}
</style>
